package ai.people.core.security.util;

import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 加密
 *
 * @author yuanqinglong
 * @date 2022/6/9 10:13
 */
public class EncryptUtils{

    private static final BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();


    /**
     * bCrypt加密
     *
     * @param source 源
     * @return {@link String}
     */
    public static String bCryptEncoder(String source){
        return bCryptPasswordEncoder.encode(source);
    }

    /**
     * bCrypt加密
     *
     * @param source 源
     * @return {@link String}
     */
    public static String md5Encoder(String source){
        return DigestUtils.md5Hex(source);
    }


}
